home *** CD-ROM | disk | FTP | other *** search
- /*
- GraphicsModule.c -- adapted from original by Leo Breebaart.
-
- CodeWarior version.
-
- This file provides a generic interface for writing a After Dark™ graphics module.
- The function "main" is called by After Dark and passed four parameters:
-
- storage: A Handle to memory you have allocated.
- blankRgn: A region covering all screens.
- message: A value indicating which function to call.
- params: A pointer to a structure containing useful information.
-
- To use it, write the five routines:
-
- OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoClose(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoDrawFrame(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoSetUp(RgnHandle blankRgn, short message, GMParamBlockPtr params);
-
- For more information, consult the programmer's section of the manual.
-
- The following people are all conspirators in this code:
- Patrick Beard
- Bruce Burkhalter
- Colin Glassey
- Andrew Armstrong
-
- ©1989-1995 Berkeley Systems, Inc.
- */
-
- #include "GraphicsModule_Types.h"
- #include "ModuleFunctions.h"
-
- pascal OSErr
- main (Handle *storage, RgnHandle blankRgn, short message, GMParamBlockPtr params)
- {
- OSErr err = noErr;
-
- /* dispatch message to appropriate routine. */
-
- switch(message)
- {
- case Initialize:
- err = DoInitialize(storage, params);
- break;
-
- case Close:
- err = DoClose(*storage, blankRgn, params);
- break;
-
- case Blank:
- err = DoBlank(*storage, blankRgn, params);
- break;
-
- case DrawFrame:
- err = DoDrawFrame(*storage, params);
- break;
-
- case ModuleSelected:
- err = DoModuleSelected(params);
- break;
-
- case DoAbout:
- //SysBeep(2); SysBeep(2); Delay(180, &dummy);
- err = DoAboutBox(params);
- break;
-
- /* Check to see if the user pressed a button. */
- default:
- if (message >= ButtonMessage)
- err = DoButton(message, params);
- break;
- }
-
- return err;
- }
-